Skip to content

fix: escape BRE special characters when selecting author from suggestions#2494

Merged
love-linger merged 1 commit into
sourcegit-scm:developfrom
JC-Chung:fix/author-search-bre-escape
Jun 29, 2026
Merged

fix: escape BRE special characters when selecting author from suggestions#2494
love-linger merged 1 commit into
sourcegit-scm:developfrom
JC-Chung:fix/author-search-bre-escape

Conversation

@JC-Chung

Copy link
Copy Markdown
Contributor

Problem

When a User suggestion (e.g. github-actions[bot]) is selected in the author search,
the filter is passed directly to git log --author= as a POSIX BRE pattern.
[bot] is interpreted as a character class, so no commits are found.

Solution

  • Add EscapeForBRE() to StringExtensions to escape BRE special characters
  • Add _isLiteralFilter field and SetLiteralFilter() to SearchCommitContext
  • Call SetLiteralFilter() when a User suggestion is selected; StartSearch() then
    applies EscapeForBRE() before passing the filter to git log --author=
  • Manual text input resets _isLiteralFilter, preserving BRE regex for power users

@love-linger love-linger self-assigned this Jun 29, 2026
@love-linger love-linger added the bug Something isn't working label Jun 29, 2026
@love-linger love-linger merged commit 1e25529 into sourcegit-scm:develop Jun 29, 2026
14 checks passed
@JC-Chung JC-Chung deleted the fix/author-search-bre-escape branch June 29, 2026 08:05
love-linger added a commit that referenced this pull request Jun 29, 2026
Since `EscapeForBRE` is only used when selecting item in suggestion popup (and the
searching command runs immediately after it), directly call `EscapeForBRE` to generate
the searching filter

Signed-off-by: leo <longshuang@msn.cn>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants